/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rad.Java.MotelPlus.Class;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import rad.Java.Common.Class.DefaultClass;
import rad.Java.Common.Class.IClass;

/**
 *
 * @author rogerio
 */
public class Sale extends DefaultClass implements IClass{
    // <editor-fold defaultstate="collapsed" desc="Declaration of variables">
        private String _stay_id;
        private String _price;
        private String _discount;
        private String _increment;
        private String _total;
    // </editor-fold>

    public Sale()
    {
        _gsql.setTable("sale");
        _sequence = "sale_sale_id_seq";
    }

    // <editor-fold defaultstate="collapsed" desc="Declaration of methods Get and Set">
        public String getDiscount() {
            return _discount;
        }

        public void setDiscount(String _discount) {
            this._discount = _discount;
        }

        public String getIncrement() {
            return _increment;
        }

        public void setIncrement(String _increment) {
            this._increment = _increment;
        }

        public String getPrice() {
            return _price;
        }

        public void setPrice(String _price) {
            this._price = _price;
        }

        public String getStay_id() {
            return _stay_id;
        }

        public void setStay_id(String _stay_id) {
            this._stay_id = _stay_id;
        }

        public String getTotal() {
            return _total;
        }

        public void setTotal(String _total) {
            this._total = _total;
        }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Declaration of functions">
        public void clear() {
            _id             = "";
            _stay_id        = "";
            _price          = "";
            _discount       = "";
            _increment      = "";
            _total          = "";
        }

        @Override
        public void get(ResultSet rs) {
            try {
                _id             = rs.getString("sale_id");
                _stay_id        = rs.getString("sale_stay_id");
                _price          = rs.getString("sale_price");
                _discount       = rs.getString("sale_discount");
                _increment      = rs.getString("sale_increment");
                _total          = rs.getString("sale_total");
            } catch (SQLException ex) {
                Logger.getLogger(Sale.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        @Override
        public void setGsql() {
            _gsql.setValue( _id                 , "sale_id");
            _gsql.setValue( _stay_id            , "sale_stay_id");
            _gsql.setValue( _price              , "sale_price");
            _gsql.setValue( _discount           , "sale_discount");
            _gsql.setValue( _increment          , "sale_increment");
            _gsql.setValue( _total              , "sale_total");
        }
    // </editor-fold>
}
